import { storeToRefs } from 'pinia'
import { useUserStore } from '@/store'

export const usePermission = () => {
  const { currentRole } = storeToRefs(useUserStore())

  const hasPermission = (...roles) => {
    return !!currentRole.value?.enable && roles.includes(currentRole.value?.code)
  }

  return {
    hasPermission,
  }
}
